package org.origin.ferret.system.model.entity;

import com.alibaba.fastjson2.annotation.JSONType;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.origin.ferret.center.model.base.BasicEntity;
import org.origin.centre.support.base.annotations.XMapper;
import org.origin.ferret.system.model.enums.UserGenderEnum;
import org.origin.ferret.system.model.enums.UserStatusEnum;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 系统用户-实体类
 *
 * @author ferret
 * @version 2024-05-08
 */
@Data
@Accessors(chain = true)
@Table("sys_user")
@Schema(description = "系统用户-实体类")
@JSONType(ignores = {"password"})
@JsonIgnoreProperties(value = {"password"})
@JsonInclude(JsonInclude.Include.NON_NULL)
@EqualsAndHashCode(callSuper = true)
public class SysUserEntity extends BasicEntity {

    @Id(keyType = KeyType.Auto)
    @Schema(description = "主键")
    private Long id;

    @Schema(description = "账户")
    private String account;

    @Schema(description = "密码")
    private String password;

    @Schema(description = "名称")
    private String name;

    @Schema(description = "头像")
    private String photo;

    @Schema(description = "手机")
    private String phone;

    @Schema(description = "性别")
    @XMapper(UserGenderEnum.class)
    private Integer gender;

    @Schema(description = "生日")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birth;

    @Schema(description = "证件")
    private String identity;

    @Schema(description = "状态")
    @XMapper(UserStatusEnum.class)
    private Integer status;
}
